import Vue from 'vue'
import Router from 'vue-router'
const Footer = () => import('@/components/Footer')
const Header = () => import('@/components/Header')
const BookCity = () => import('@/components/bookCity/index')
const BookSelf = () => import('@/components/bookself/index')
const BookSelfHeader = () => import('@/components/bookself/header')
const Free = () => import('@/components/free/index')
const FreeHeader = () => import('@/components/free/header')
const User = () => import('@/components/user/index')
const Classify = () => import('@/components/classify/index')
const ClassifyHeader = () => import('@/components/classify/header')
const RankingList = () => import('@/components/rankingList/index')
const RankingListHeader = () => import('@/components/rankingList/header')
const ClassifyDetail = () => import('@/components/classifyDetail/index')
const RankingDetail = () => import('@/components/rankingDetail/index')
const Detail = () => import('@/components/detail/index')
const Booklist = () => import('@/components/booklists/index')
const BooklistDetail = () => import('@/components/booklists/booklistDetail')
const CataLog = () => import('@/components/catalog/index')
const Content = () => import('@/components/content/index')
const Login = () => import('@/components/user/login')
const NoLogin = () => import('@/components/user/nologin')
const Loginpage = () => import('@/components/loginAndReg/index')
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/bookself'
    },
    {
      path: '/classify',
      name: 'classify',
      components: {
        header: ClassifyHeader,
        default: Classify
      }
    },
    {
      path: '/content',
      name: 'content',
      components: {
        default: Content
      }
    },
    {
      path: '/catalog',
      name: 'catalog',
      components: {
        default: CataLog
      }
    },
    {
      path: '/booklist',
      name: 'booklist',
      components: {
        header: ClassifyHeader,
        default: Booklist
      }
    },
    {
      path: '/login',
      name: 'login',
      components: {
        default: Loginpage
      }
    },
    {
      path: '/booklistdetail',
      name: 'booklistdetail',
      components: {
        header: ClassifyHeader,
        default: BooklistDetail
      }
    },
    {
      path: '/detail',
      name: 'detail',
      components: {
        default: Detail
      }
    },
    {
      path: '/classifydetail',
      name: 'classifydetail',
      components: {
        header: ClassifyHeader,
        default: ClassifyDetail
      }
    },
    {
      path: '/rankingdetail',
      name: 'rankingdetail',
      components: {
        header: RankingListHeader,
        default: RankingDetail
      }
    },
    {
      path: '/rankingList',
      name: 'rankingList',
      components: {
        header: RankingListHeader,
        default: RankingList
      }
    },
    {
      path: '/bookcity',
      name: 'bookcity',
      components: {
        header: Header,
        default: BookCity,
        footer: Footer
      }
    },
    {
      path: '/bookself',
      name: 'bookself',
      components: {
        header: BookSelfHeader,
        default: BookSelf,
        footer: Footer
      }
    },
    {
      path: '/free',
      name: 'free',
      components: {
        header: FreeHeader,
        default: Free,
        footer: Footer
      }
    },
    {
      path: '/user',
      name: 'user',
      components: {
        header: Header,
        default: User,
        footer: Footer
      },
      redirect: '/user/noLogin',
      children: [
        {
          path: 'login',
          component: Login
        },
        {
          path: 'noLogin',
          component: NoLogin
        }
      ]
    }
  ]
})
